home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_riv_comdoor2.cog < prev    next >
Text File  |  1999-11-15  |  7KB  |  285 lines

  1. # Jones 3D Cog Script
  2. #
  3. # RIV_ComDoor2.cog
  4. #
  5. # [TRM]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13.     message     startup
  14.     message     entered
  15.     message     exited
  16.     message     activated
  17.     message     blocked
  18.     message     timer
  19.  
  20.     thing       player      local
  21.     thing       door
  22.     thing       button1
  23.     thing       camOffset1
  24.     
  25.     surface     surf0       linkID=1
  26.     surface     surf1       linkID=1
  27.     
  28.     sound       snd_DoorOpen=bab_door_metal_slide_c.wav     local
  29.     sound       snd_DoorStop=bab_door_metal_stop.wav        local
  30.     sound       snd_Button=gen_wood_button.wav              local
  31.     
  32.     # ** voice lines **
  33.     sound        in_DoorLine0=Inxj096.wav                local # I can't open it.
  34.     sound        in_DoorLine1=Inxj098.wav                local # It won't budge.
  35.     sound        in_DoorLine2=Inxj099.wav                local # Something is holding this door closed.
  36.     sound        in_DoorLine3=Inxj102.wav                local # ...I can't seem to open it from this side.
  37.     
  38.     flex        openDoor        local
  39.     flex        closeDoor       local
  40.     flex        randstucklines  local
  41.     
  42.     int         open=0          local
  43.     int         playing=0       local
  44.     int         firstTime=1     local
  45.     int         otherSide=0     local
  46.     int         chnl_Door       local
  47.     int         newLine         local
  48.     int         oldLine         local
  49.     int         autoClose
  50.     
  51. end
  52.  
  53. # ========================================================================================
  54.  
  55. code
  56.  
  57. startup:
  58.  
  59.     player = GetLocalPlayerThing();
  60.     SetThingLight(button1, '0.25 0.25 0.25', 0.01, 0.5);
  61.     SetThingLight(door, '0.25 0.25 0.25', 0.01, 0.5);
  62.     return;
  63.     
  64. # ========================================================================================
  65.  
  66. entered:
  67.  
  68.     if(GetSenderID() == 1)
  69.     {
  70.         otherSide = 1;
  71.     }
  72.     
  73.     return;
  74.     
  75. # ========================================================================================
  76.  
  77. exited:
  78.  
  79.     if((GetSenderID() == 1) && (GetSourceRef() == player))
  80.     {
  81.         otherSide = 0;
  82.     }
  83.     
  84.     return;
  85.     
  86. # ========================================================================================
  87.  
  88. activated:
  89.  
  90.     if((GetSenderRef() == button1) && (open == 0) && (playing == 0))
  91.     {
  92.         playing = 1;
  93.         Call openDoor;
  94.     }
  95.     
  96.     else if((GetSenderRef() == button1) && (open == 1) && (autoClose == 0) && (playing == 0))
  97.     {
  98.         playing = 1;
  99.         Call closeDoor;
  100.     }
  101.     
  102.     else if((GetSenderRef() == door) && (otherSide == 1) && (playing == 0))
  103.     {
  104.         Call randstucklines;
  105.     }
  106.     
  107.     return;
  108.     
  109. # ========================================================================================
  110.  
  111. openDoor:
  112.  
  113.     open = 1;
  114.  
  115.     # do cutscene stuff
  116.     MakeMeStop();
  117.     StartCutscene(0);
  118.     
  119.     #SetExtCamOffsetToThing(camOffset1);
  120.     
  121.     # put away any weapon
  122.     DeselectWeaponWait(player);
  123.     
  124.     PlayMode(player, 60, 0);
  125.     Sleep(0.3);
  126.     
  127.     PlaySoundThing(snd_Button, button1, 1.0, 2.0, 5.0, 0);
  128.     MoveToFrame(button1, 1, 1.0);
  129.     WaitForStop(button1);
  130.     
  131.     SetCollideType(door, 0);
  132.     chnl_Door = PlaySoundThing(snd_DoorOpen, door, 1.0, 5.0, 10.0, 0);
  133.     MoveToFrame(door, 1, 2.0);
  134.     WaitForStop(door);
  135.     StopSound(chnl_Door, 0.5);
  136.     PlaySoundThing(snd_DoorStop, door, 1.0, 5.0, 10.0, 0);
  137.     SetCollideType(door, 3);
  138.     
  139.     if(autoClose == 1)
  140.     {
  141.         SetTimer(8.0);
  142.     }
  143.     
  144.     else
  145.     {
  146.         Sleep(0.25);
  147.         PlaySoundThing(snd_Button, button1, 1.0, 5.0, 10.0, 0);
  148.         MoveToFrame(button1, 0, 1.0);
  149.         WaitForStop(button1);
  150.         playing = 0;
  151.     }
  152.     
  153.     #RestoreExtCam();
  154.     
  155.     # return control to player
  156.     ClearActorFlags(player, 0x200000);
  157.     EndCutscene();
  158.     
  159.     return;
  160.     
  161. # ========================================================================================
  162.  
  163. closeDoor:
  164.  
  165.     open = 0;
  166.  
  167.     # do cutscene stuff
  168.     MakeMeStop();
  169.     StartCutscene(0);
  170.     
  171.     #SetExtCamOffsetToThing(camOffset1);
  172.     
  173.     # put away any weapon
  174.     DeselectWeaponWait(player);
  175.     
  176.     PlayMode(player, 60, 0);
  177.     Sleep(0.3);
  178.     
  179.     PlaySoundThing(snd_Button, button1, 1.0, 2.0, 5.0, 0);
  180.     MoveToFrame(button1, 1, 1.0);
  181.     WaitForStop(button1);
  182.     
  183.     SetCollideType(door, 0);
  184.     chnl_Door = PlaySoundThing(snd_DoorOpen, door, 1.0, 5.0, 10.0, 0);
  185.     MoveToFrame(door, 0, 2.0);
  186.     WaitForStop(door);
  187.     StopSound(chnl_Door, 0.5);
  188.     PlaySoundThing(snd_DoorStop, door, 1.0, 5.0, 10.0, 0);
  189.     SetCollideType(door, 3);
  190.     
  191.     Sleep(0.25);
  192.     
  193.     PlaySoundThing(snd_Button, button1, 1.0, 2.0, 5.0, 0);
  194.     MoveToFrame(button1, 0, 1.0);
  195.     WaitForStop(button1);
  196.     
  197.     playing = 0;
  198.     
  199.     #RestoreExtCam();
  200.     
  201.     # return control to player
  202.     ClearActorFlags(player, 0x200000);
  203.     EndCutscene();
  204.     
  205.     return;
  206.     
  207. # ========================================================================================
  208.  
  209. randstucklines:
  210.  
  211.     playing = 1;
  212.     
  213.     # do cutscene stuff
  214.     MakeMeStop();
  215.     StartCutscene(0);
  216.     
  217.     # put away any weapon
  218.     DeselectWeaponWait(player);
  219.     
  220.     PlayMode(player, 60, 0);
  221.     Sleep(0.3);
  222.     
  223.     if(firstTime == 1)
  224.     {
  225.         firstTime = 0;
  226.         PlayVoice(player, in_DoorLine3, 1.0, 1);
  227.         oldLine = 3;
  228.     }
  229.     
  230.     else
  231.     {
  232.         while (newLine == oldLine)
  233.         {    
  234.             newLine = RandBetween(0, 3); # pick new line
  235.         }
  236.         
  237.         oldLine = newLine; # remember what got picked
  238.         
  239.         PlayVoice(player, in_DoorLine0[newLine], 1.0, 1);
  240.     }
  241.     
  242.     # return control to player
  243.     ClearActorFlags(player, 0x200000);
  244.     EndCutscene();
  245.     
  246.     playing = 0;
  247.  
  248.     return;
  249.            
  250. # ========================================================================================
  251.  
  252. blocked:
  253.  
  254.     PlaySoundThing(snd_DoorOpen, door, 1.0, 5.0, 10.0, 0);
  255.     MoveToFrame(door, 1, 2.0);
  256.     WaitForStop(door);
  257.  
  258.     return;
  259.     
  260. # ========================================================================================
  261.  
  262. timer:
  263.  
  264.     PlaySoundThing(snd_Button, button1, 1.0, 2.0, 5.0, 0);
  265.     MoveToFrame(button1, 0, 1.0);
  266.     WaitForStop(button1);
  267.     Sleep(0.25);
  268.     
  269.     SetCollideType(door, 0);
  270.     chnl_Door = PlaySoundThing(snd_DoorOpen, door, 1.0, 5.0, 10.0, 0);
  271.     MoveToFrame(door, 0, 2.0);
  272.     WaitForStop(door);
  273.     StopSound(chnl_Door, 0.5);
  274.     PlaySoundThing(snd_DoorStop, door, 1.0, 5.0, 10.0, 0);
  275.     SetCollideType(door, 3);
  276.     
  277.     playing = 0;
  278.     open = 0;
  279.     
  280.     return;
  281.  
  282. # ========================================================================================
  283.  
  284. end
  285.